<%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>


<script type="text/javascript" src="${pageContext.request.contextPath}/js/soso/file.js"></script>

<script type="text/javascript"
        src="${pageContext.request.contextPath}/ajax/interface/FileServiceRemote.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/ajax/interface/UserServiceRemote.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/util.js"></script>

<div id="login-div" class="panel">
    <label for="login-panel" class="panel-header">User Info</label>

    <div id="login-panel" class="panelContent">
        <div id="userLog">
            Hello ${sessionScope['logged'].name}<br/>
            <form:form method="GET" action="logout.html">
                <button type="submit" id="logoutButton">Logout</button>
            </form:form>
        </div>
    </div>
</div>

<div id="upload-div" class="panel">
    <label for="upload-panel" class="panel-header">Upload Files</label>

    <div id="upload-panel" class="panelContent">
        <table>
            <tr>
                <td><label for="file">File:</label></td>
                <td><input id="file" type="file"/></td>
            </tr>

            <tr>
                <td><label for="public">Public File</label></td>
                <td><input id="public" type="checkbox"/></td>
            </tr>

            <tr>
                <td><label for="description">Description</label></td>
                <td><textarea id="description" cols="20" rows="1"></textarea></td>
            </tr>

            <tr>
                <td><label for="category">Category</label></td>
                <td>
                    <select id="category">
                        <c:forEach var="cat" items="${categoryList}">
                            <option title="${cat.name}" value="${cat.id}">${cat.name}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
        </table>
        <div class="button-panel">
            <button id="upload" type="button">Upload</button>
        </div>
    </div>
</div>

<div id="myfiles-div" class="panel">
    <label for="myFilesPanel" class="panel-header">My Files</label>

    <div id="myFilesPanel" class="panelContent">
        <fieldset>
            <div align="center">
                <button type="button" id="refreshData">Refresh</button>
            </div>
        </fieldset>
        <div id="myFilesGrid" style="height: 200px"></div>
    </div>
</div>

<div id="allfiles-div" class="panel">
    <label for="allfiles-panel" class="panel-header">All Files</label>

    <div id="allfiles-panel" class="panelContent">
        <fieldset>
            <div align="center">
                <button type="button" id="refreshAllData">Refresh</button>
            </div>
        </fieldset>
        <div id="allFilesGrid" style="height: 210px"></div>
    </div>
</div>
